package com.scqzy.shengchunqiang.sword2offer.day18;

import com.scqzy.shengchunqiang.structure.TreeNode;

import java.util.Objects;

/**
 * @Description: 剑指 Offer 55 - I. 二叉树的深度
 * @Author 盛春强
 * @Date 2021/8/25 19:35
 */
public class MaxDepth {
    public int maxDepth(TreeNode root) {
        if (Objects.isNull(root)) {
            return 0;
        }
        return Math.max(maxDepth(root.left),maxDepth(root.right))+1;
    }
}
